import { createApp } from "vue";
import "./style.css";
import App from "./App.vue";
import ElementPlus from "element-plus";
import "element-plus/dist/index.css";
import { createRouter, createWebHashHistory } from "vue-router";
import Antd from "ant-design-vue";
import "ant-design-vue/dist/reset.css";
import Index from "./views/Index.vue";
import Console from "./views/Console.vue";
import ConsoleContent from "./components/Console/ConsoleContent.vue";
import Product from "./components/Console/Product/Product.vue";
import Login from "./components/Login/Login.vue";
import Register from "./components/Login/Register.vue";
import { createPinia } from "pinia";
import "echarts-liquidfill";
import "uno.css";
import Service from "./components/Console/Service/Service.vue";
import { productMenuList } from "./components/Console/Menu/Product";
import { serviceMenuList } from "./components/Console/Menu/Service";
import { genSubMenu } from "./components/Console/Menu/Menu";
import { financeMenuList } from "./components/Console/Menu/Finance";
import Finance from "./components/Console/Finance/Finance.vue";
import Account from "./components/Console/Account/Account.vue";
import { accountMenuList } from "./components/Console/Menu/Account";
import Tools from "./components/Console/Tools/Tools.vue";
import { toolsMenuList } from "./components/Console/Menu/Tools";
import News from "./views/News.vue";
import { indexMenuList } from "./components/Index/Menu/Index";
import { cartMenuList } from "./components/Console/Menu/Cart";
import Cart from "./components/Console/Cart/Cart.vue";
// import ConfirmOrder from "./components/Console/ConfirmOrder/ConfirmOrder.vue";
// import { confirmOrderMenuList } from "./components/Console/Menu/ConfirmOrder";

const routes = [
  {
    path: "/", component: Index, children: genSubMenu(indexMenuList, 'index')
  },
  { path: "/login", component: Login },
  { path: "/register", component: Register },
  {
    path: "/console",
    component: Console,
    children: [
      { path: "", component: ConsoleContent },
      {
        path: "/product",
        component: Product,
        children: genSubMenu(productMenuList, "product"),
      },
      {
        path: "/service",
        component: Service,
        children: genSubMenu(serviceMenuList, "service"),
      },
      {
        path: "/finance",
        component: Finance,
        children: genSubMenu(financeMenuList, "finance"),
      },
      {
        path: "/account",
        component: Account,
        children: genSubMenu(accountMenuList, "account"),
      },
      {
        path: "/tools",
        component: Tools,
        children: genSubMenu(toolsMenuList, "tools"),
      },
      {
        path: "/cart",
        component: Cart,
        children: genSubMenu(cartMenuList, "cart"),
      },
      // {
      //   path: "/confirmOrder",
      //   component: ConfirmOrder,
      //   children: genSubMenu(confirmOrderMenuList, 'confirmOrder')
      // }

    ],
  },
  {
    path: "/news/:id",
    component: News
  }
];

const router = createRouter({
  history: createWebHashHistory(),
  routes,
});

const pinia = createPinia();

createApp(App).use(pinia).use(Antd).use(router).use(ElementPlus).mount("#app");
